//
//  CustomPageControl.m
//  Project two framework
//
//  Created by 张峥 on 16/8/1.
//  Copyright © 2016年 张峥. All rights reserved.
//

#import "CustomPageControl.h"

@interface CustomPageControl ()
@property (nonatomic, strong) UIView     *redView;
@property (nonatomic, strong) UIView     *grayView;

@end

@implementation CustomPageControl

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self stepUI];
    }
    return self;
}

- (void)stepUI{
    _redView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.frame)/2-10,0, 12, 12)];
    _redView.layer.cornerRadius = 6;
    _redView.backgroundColor = [UIColor colorWithRed:148/255.0 green:26/255.0 blue:55/255.0 alpha:1];
    [self addSubview:_redView];
    
    _grayView= [[UIView alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.frame)/2+10,0, 12, 12)];
    _grayView.layer.cornerRadius = 6;
    _grayView.backgroundColor = [UIColor grayColor];
    [self addSubview:_grayView];
}

- (void)setRect:(BOOL)isRect{
    if (isRect == NO) {
        _grayView.backgroundColor = [UIColor colorWithRed:148/255.0 green:26/255.0 blue:55/255.0 alpha:1];
        _redView.backgroundColor = [UIColor grayColor];
    }else{
        _redView.backgroundColor = [UIColor colorWithRed:148/255.0 green:26/255.0 blue:55/255.0 alpha:1];
        _grayView.backgroundColor = [UIColor grayColor];
    }
}

@end
